<HTML><HEAD><TITLE>erase_module(+Module)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Modules</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>erase_module(+Module)</H1>
Erase the given module Module.  
<DL>
<DT><EM>Module</EM></DT>
<DD>Atom.
</DD>
</DL>
<H2>Description</H2>
    erase_module/1 erases the given module.  This means that the module
    will not exists any more.  All predicates and data (non-logical variables,
    records, etc) defined in the module will be destroyed.  Subsequent calls
    to the module's exported predicates will raise 'undefined procedure'
    errors.
<P>
    If the Module does not exist, erase_module/1 simply succeeds.
<P>
    An error (101) is raised when trying to erase a module from within itself.
<P>
    Note that a module gets erased (and re-created) implicitly when the
    compiler encounters a module/1 directive and that module already exists.

<H3>Modes and Determinism</H3><UL>
<LI>erase_module(+) is det
</UL>
<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>Module is not instantiated.
<DT><EM>(5) type error </EM>
<DD>Module is not an atom.
<DT><EM>(101) trying to erase a module from itself </EM>
<DD>Trying to erase Module from itself.
</DL>
<H2>Examples</H2>
<PRE>
Success:
[eclipse]:  [user].
 :- module(m).
 :- export a/0.
 a :- writeln(hello).
 user        compiled 60 bytes in 0.00 seconds
yes.
[eclipse]: import a/0 from m.
yes.
[eclipse]: a.
hello
yes.
[eclipse]: erase_module(m).
yes.
[eclipse]: a.
calling an undefined procedure a in module eclipse

Error:
    erase_module(M).                   (Error 4).
    erase_module(1).                   (Error 5).
    erase_module(mod)@mod.             (Error 101).
</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/modules/module-1.html">module / 1</A>, <A HREF="../../kernel/modules/create_module-1.html">create_module / 1</A>, <A HREF="../../kernel/modules/create_module-3.html">create_module / 3</A>, <A HREF="../../kernel/modules/current_module-1.html">current_module / 1</A>, <A HREF="../../kernel/modules/get_module_info-3.html">get_module_info / 3</A>
</BODY></HTML>
